// **************************************************************
// Com ++ Framework by the C++ World
// Please report defects: mailto:compp@cplusplusworld.com
// Please visit: http://www.cplusplusworld.com/socketlibrary.html
// **************************************************************

#include <iostream>

//#include "config.h"
#include "SysPlusPlus/syscall.h"
#include "ComPlusPlus/Clone.h"
#include "SysPlusPlus/ComException.h"



/**
  * constructor
  **/
compp::Clone::Clone() {

}

/**
  * constructor
  **/
/**
  * constructor
  **/
compp::Clone::Clone ( const std::string & cmd ) : Process (cmd) {

  
  
}

/**
  * Start Process
  **/
int compp::Clone::Start() {
int i;
switch ( i=syspp::Call::Fork() ) {
	case -1: {
 	 throw syspp::ComException ( "PANIC: Cannot create new Process." );
	 break;
	}
	case 0: {
	  exit(Run());
	  break;
	}
  	default: {
	  Pid = i;
	  Name = "Clone";
	  return Pid;
	}
}
}

/**
  * Destructor
  **/
compp::Clone::~Clone() {

 if ( TerminateInDestructor ) {
	GracefulTerminate();
	Terminate();
 }

}


/**
 * 
 **/
int  compp::Clone::Run ( ) {

 return 0; // HI LINT 
}

